Skip to content

Adds workflow replay-safe logger#1434

Merged
WhitWaldo merged 19 commits into
dapr:masterfrom
WhitWaldo:workflow-logger
Dec 19, 2024
Merged

Adds workflow replay-safe logger#1434
WhitWaldo merged 19 commits into
dapr:masterfrom
WhitWaldo:workflow-logger

Conversation

@WhitWaldo
Copy link
Copy Markdown
Contributor

@WhitWaldo WhitWaldo commented Dec 19, 2024

Description

By popular demand in Discord and after realizing that a lot of the plumbing was already available in the Durable Task SDK itself, I've implemented the version of the ReplaySafe logger used in that version (as opposed to the version in the Azure Functions Durable Task (https://github.com/Azure/azure-functions-durable-extension/tree/dev/src/WebJobs.Extensions.DurableTask). I made a few tweaks to the visibility on the context itself so conform to how Dapr implements the SDK, but nothing major.

As a result, there's a method available on the WorkflowContext for CreateReplaySafeLogger that will provision an ILogger using the category name or the provided type of the context (provided either as an argument or a generic type) from the ILoggerFactory provisioned within the Durable Task SDK itself and its various registrations.

I updated one of the Workflow examples to include the intended usage.

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…nullability errors

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…o create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…ation context

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…e in the context made visible to workflow developers

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
# Conflicts:
#	src/Dapr.Workflow/WorkflowServiceCollectionExtensions.cs
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@WhitWaldo WhitWaldo added this to the v1.15 milestone Dec 19, 2024
@WhitWaldo WhitWaldo self-assigned this Dec 19, 2024
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@WhitWaldo WhitWaldo marked this pull request as ready for review December 19, 2024 07:05
@WhitWaldo WhitWaldo requested review from a team as code owners December 19, 2024 07:05
Comment thread src/Dapr.Workflow/DaprWorkflowContext.cs Outdated
…to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@WhitWaldo WhitWaldo merged commit a61db8b into dapr:master Dec 19, 2024
@WhitWaldo WhitWaldo deleted the workflow-logger branch December 19, 2024 22:23
jev-e pushed a commit to jev-e/jev-dotnet-sdk that referenced this pull request Dec 26, 2024
* Removed obsolete type

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added missing using

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Adding interface for IWorkflowContext for replayability concerns

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unused IConfiguration

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added ReplaySafeLogger type

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Building out functionality to expose ReplayLogger in workflow context

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added license information to file

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary file

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Updated copyright header for different project, made some tweaks for nullability errors

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added virtual methods that use the already-available ILoggerFactory to create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary registration

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Updated example to demonstrate using ReplaySafeLogger in the orchestration context

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Tweaks on visibility and abstraction so that the methods are available in the context made visible to workflow developers

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed obsolete type registrations

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Simplified argument null check

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed since-removed code leftover from merge

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added documentation demonstrating how to access the replay-safe logger

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary and separate ReplaySafeLogger in favor of method to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

---------

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
jev-e pushed a commit to jev-e/jev-dotnet-sdk that referenced this pull request Dec 26, 2024
* Removed obsolete type

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added missing using

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Adding interface for IWorkflowContext for replayability concerns

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unused IConfiguration

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added ReplaySafeLogger type

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Building out functionality to expose ReplayLogger in workflow context

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added license information to file

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary file

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Updated copyright header for different project, made some tweaks for nullability errors

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added virtual methods that use the already-available ILoggerFactory to create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary registration

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Updated example to demonstrate using ReplaySafeLogger in the orchestration context

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Tweaks on visibility and abstraction so that the methods are available in the context made visible to workflow developers

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed obsolete type registrations

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Simplified argument null check

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed since-removed code leftover from merge

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Added documentation demonstrating how to access the replay-safe logger

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Removed unnecessary and separate ReplaySafeLogger in favor of method to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

---------

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: jev <jacob@jev.org.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants